package com.jiangsen.script.gitbook.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 配置文件工具类
 *
 * @author Johnson
 * @date 2020/3/10.
 */
public class ConfigUtil {
    private final static String localImageDir;
    private final static String remoteImageDir;
    
    static {
        Properties properties = new Properties();
        try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties");) {
            properties.load(in);
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("读取 application.properties 失败");
        }
        localImageDir = properties.getProperty("local.images.dir").replace("\\", "/");
        remoteImageDir = properties.getProperty("remote.images.dir");
    }
    
    public static String getLocalImageDir() {
        return localImageDir;
    }
    
    public static String getRemoteImageDir() {
        return remoteImageDir;
    }
}
